package com.softeem.xyblogmaster.config;

import com.softeem.xyblogmaster.interceptor.AuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//springboot 抛弃了springmvc.xml
//所有的配置到写到类里面
@Configuration
public class MvcConfig implements WebMvcConfigurer {

    @Autowired
    private AuthInterceptor authInterceptor;


    //加入我们自定义的拦截器
    //重写方法 addInterceptors


    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/auth/getCaptcha2222","/auth/doLogin", "/auth/doRegister","/auth/getImage");// 拦截所有路径
        // 排除特定路径
    }
}
